.class public final Lcom/adwhirl/a/i;
.super Lcom/adwhirl/a/c;
.source "GoogleAdMobAdsAdapter.java"

# interfaces
.implements Lcom/google/ads/AdListener;


# direct methods
.method public constructor <init>(Lcom/adwhirl/AdWhirlLayout;Lcom/adwhirl/b/c;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 32
    invoke-direct {p0, p1, p2}, Lcom/adwhirl/a/c;-><init>(Lcom/adwhirl/AdWhirlLayout;Lcom/adwhirl/b/c;)V

    .line 33
    return-void
.end method

.method private static a(Lcom/adwhirl/AdWhirlLayout;)Lcom/google/ads/AdRequest;
    .locals 3
    .parameter

    .prologue
    .line 73
    new-instance v0, Lcom/google/ads/AdRequest;

    invoke-direct {v0}, Lcom/google/ads/AdRequest;-><init>()V

    .line 75
    invoke-static {}, Lcom/adwhirl/h;->a()Z

    move-result v1

    invoke-virtual {v0, v1}, Lcom/google/ads/AdRequest;->setTesting(Z)V

    .line 76
    invoke-static {}, Lcom/adwhirl/a/i;->c()Lcom/google/ads/AdRequest$Gender;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/google/ads/AdRequest;->setGender(Lcom/google/ads/AdRequest$Gender;)V

    .line 77
    invoke-static {}, Lcom/adwhirl/a/i;->b()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/google/ads/AdRequest;->setBirthday(Ljava/lang/String;)V

    .line 79
    iget-object v1, p0, Lcom/adwhirl/AdWhirlLayout;->d:Lcom/adwhirl/b/b;

    iget v1, v1, Lcom/adwhirl/b/b;->j:I

    const/4 v2, 0x1

    if-ne v1, v2, :cond_0

    .line 80
    iget-object v1, p0, Lcom/adwhirl/AdWhirlLayout;->j:Lcom/adwhirl/g;

    iget-object v1, v1, Lcom/adwhirl/g;->e:Landroid/location/Location;

    invoke-virtual {v0, v1}, Lcom/google/ads/AdRequest;->setLocation(Landroid/location/Location;)V

    .line 83
    :cond_0
    invoke-static {}, Lcom/adwhirl/h;->g()Ljava/util/Set;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/google/ads/AdRequest;->setKeywords(Ljava/util/Set;)V

    .line 85
    return-object v0
.end method

.method private static b()Ljava/lang/String;
    .locals 2

    .prologue
    .line 36
    invoke-static {}, Lcom/adwhirl/h;->e()Ljava/util/GregorianCalendar;

    move-result-object v0

    if-eqz v0, :cond_0

    new-instance v0, Ljava/text/SimpleDateFormat;

    const-string v1, "yyyyMMdd"

    invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V

    invoke-static {}, Lcom/adwhirl/h;->e()Ljava/util/GregorianCalendar;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/GregorianCalendar;->getTime()Ljava/util/Date;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v0

    :goto_0
    return-object v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private static c()Lcom/google/ads/AdRequest$Gender;
    .locals 2

    .prologue
    .line 42
    sget-object v0, Lcom/adwhirl/a/j;->a:[I

    invoke-static {}, Lcom/adwhirl/h;->c()Lcom/adwhirl/i;

    move-result-object v1

    invoke-virtual {v1}, Lcom/adwhirl/i;->ordinal()I

    move-result v1

    aget v0, v0, v1

    packed-switch v0, :pswitch_data_0

    .line 45
    const/4 v0, 0x0

    :goto_0
    return-object v0

    .line 43
    :pswitch_0
    sget-object v0, Lcom/google/ads/AdRequest$Gender;->MALE:Lcom/google/ads/AdRequest$Gender;

    goto :goto_0

    .line 44
    :pswitch_1
    sget-object v0, Lcom/google/ads/AdRequest$Gender;->FEMALE:Lcom/google/ads/AdRequest$Gender;

    goto :goto_0

    .line 42
    nop

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method private static e(Ljava/lang/String;)V
    .locals 2
    .parameter

    .prologue
    .line 69
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "GoogleAdapter "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    .line 70
    return-void
.end method


# virtual methods
.method public final a()V
    .locals 5

    .prologue
    .line 51
    iget-object v0, p0, Lcom/adwhirl/a/i;->a:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/adwhirl/AdWhirlLayout;

    .line 53
    if-nez v0, :cond_1

    .line 66
    :cond_0
    :goto_0
    return-void

    .line 57
    :cond_1
    iget-object v1, v0, Lcom/adwhirl/AdWhirlLayout;->a:Ljava/lang/ref/WeakReference;

    invoke-virtual {v1}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/app/Activity;

    .line 58
    if-eqz v1, :cond_0

    .line 62
    new-instance v2, Lcom/google/ads/AdView;

    sget-object v3, Lcom/google/ads/AdSize;->BANNER:Lcom/google/ads/AdSize;

    iget-object v4, p0, Lcom/adwhirl/a/i;->b:Lcom/adwhirl/b/c;

    iget-object v4, v4, Lcom/adwhirl/b/c;->e:Ljava/lang/String;

    invoke-direct {v2, v1, v3, v4}, Lcom/google/ads/AdView;-><init>(Landroid/app/Activity;Lcom/google/ads/AdSize;Ljava/lang/String;)V

    .line 64
    invoke-virtual {v2, p0}, Lcom/google/ads/AdView;->setAdListener(Lcom/google/ads/AdListener;)V

    .line 65
    invoke-static {v0}, Lcom/adwhirl/a/i;->a(Lcom/adwhirl/AdWhirlLayout;)Lcom/google/ads/AdRequest;

    move-result-object v0

    invoke-virtual {v2, v0}, Lcom/google/ads/AdView;->loadAd(Lcom/google/ads/AdRequest;)V

    goto :goto_0
.end method

.method public final onDismissScreen(Lcom/google/ads/Ad;)V
    .locals 0
    .parameter

    .prologue
    .line 90
    return-void
.end method

.method public final onFailedToReceiveAd(Lcom/google/ads/Ad;Lcom/google/ads/AdRequest$ErrorCode;)V
    .locals 2
    .parameter
    .parameter

    .prologue
    .line 94
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "failure ("

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ")"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/adwhirl/a/i;->e(Ljava/lang/String;)V

    .line 96
    const/4 v0, 0x0

    invoke-interface {p1, v0}, Lcom/google/ads/Ad;->setAdListener(Lcom/google/ads/AdListener;)V

    .line 98
    iget-object v0, p0, Lcom/adwhirl/a/i;->a:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lcom/adwhirl/AdWhirlLayout;

    .line 100
    if-nez p0, :cond_0

    .line 105
    :goto_0
    return-void

    .line 104
    :cond_0
    invoke-virtual {p0}, Lcom/adwhirl/AdWhirlLayout;->c()V

    goto :goto_0
.end method

.method public final onLeaveApplication(Lcom/google/ads/Ad;)V
    .locals 0
    .parameter

    .prologue
    .line 109
    return-void
.end method

.method public final onPresentScreen(Lcom/google/ads/Ad;)V
    .locals 0
    .parameter

    .prologue
    .line 113
    return-void
.end method

.method public final onReceiveAd(Lcom/google/ads/Ad;)V
    .locals 2
    .parameter

    .prologue
    .line 117
    const-string v0, "success"

    invoke-static {v0}, Lcom/adwhirl/a/i;->e(Ljava/lang/String;)V

    .line 119
    iget-object v0, p0, Lcom/adwhirl/a/i;->a:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lcom/adwhirl/AdWhirlLayout;

    .line 121
    if-nez p0, :cond_0

    .line 135
    :goto_0
    return-void

    .line 125
    :cond_0
    instance-of v0, p1, Lcom/google/ads/AdView;

    if-nez v0, :cond_1

    .line 126
    const-string v0, "invalid AdView"

    invoke-static {v0}, Lcom/adwhirl/a/i;->e(Ljava/lang/String;)V

    goto :goto_0

    .line 130
    :cond_1
    check-cast p1, Lcom/google/ads/AdView;

    .line 132
    iget-object v0, p0, Lcom/adwhirl/AdWhirlLayout;->j:Lcom/adwhirl/g;

    invoke-virtual {v0}, Lcom/adwhirl/g;->d()V

    .line 133
    iget-object v0, p0, Lcom/adwhirl/AdWhirlLayout;->b:Landroid/os/Handler;

    new-instance v1, Lcom/adwhirl/f;

    invoke-direct {v1, p0, p1}, Lcom/adwhirl/f;-><init>(Lcom/adwhirl/AdWhirlLayout;Landroid/view/ViewGroup;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 134
    invoke-virtual {p0}, Lcom/adwhirl/AdWhirlLayout;->b()V

    goto :goto_0
.end method
